package com.xl.dao.impl;

import com.xl.dao.UserDao;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

//<bean id="userDao" class="com.xl.dao.impl.UserDaoImpl"/>
//@Component(value="userDao")
//@Component("userDao")
@Repository("userDao")
//@Scope("singleton")
//@Lazy(false)
@Profile("test")
public class UserDaoImpl implements UserDao {

    @Value("张三")
    private String name;

    @Value("{zzz}")
    public void setName(String name) {
        this.name = name;
    }


    public UserDaoImpl() {
        System.out.println("userDao创建");
    }

    @PostConstruct
    public void init() {
        System.out.println("userDao初始化");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("userDao销毁");
    }

    @Override
    public void show() {
        System.out.println("name:"+name);
    }
}
